﻿using System;
using System.Collections.Generic;
using System.Text;
using Abp.AutoMapper;
using Abp.Domain.Entities;
using AutoMapper;
using FwProject.Restaurant.Dto;
using System.ComponentModel.DataAnnotations;
namespace FwProject.PrePaymentInfo.Dto
{
    /// <summary>
    /// 收款
    /// </summary>
    [AutoMap(typeof(ReceiptInfoModel))]
    public class ReceiptInfoInputEdit
    { 
        /// <summary>
        /// 收据Id
        /// </summary>
        [IgnoreMap]
        public Guid SettlementId { get; set; }
        /// <summary>
        /// 所属工厂
        /// </summary>
        public Guid FactoryinfoId { get; set; }
       
        /// <summary>
        /// 经办人id
        /// </summary>
        public Guid RestaurantId { get; set; }

        /// <summary>
        /// 整单金额 此金额是后台制单后的应收金额SettlementInfo Actualprice 字段
        /// </summary>
        public decimal WholeAmount { get; set; }
        /// <summary>
        /// 应收回金额(WholeAmount-PreferentialAmount)
        /// </summary>
        public decimal ActualAmount { get; set; }
        /// <summary>
        /// 使用预收款
        /// </summary>
        public decimal UsePrePayment { get; set; }
        /// <summary>
        /// 实际收回金额
        /// </summary>
        public decimal TaskBackAmount { get; set; }
        /// <summary>
        /// 预收款剩余金额
        /// </summary>
        public decimal UsePrePaymentSurplus { get; set; }
        /// <summary>
        /// 优惠金额
        /// </summary>
        public decimal PreferentialAmount { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        public string RemarksConten { get; set; }
    }

    [AutoMap(typeof(ReceiptInfoModel))]
    public class ReceiptInfoEnterDto
    {
        /// <summary>
        /// 收款经办人
        /// </summary>
        [Required(ErrorMessage ="经办人不能为空")]
        public string AgentPeoper { get; set; }

        /// <summary>
        /// 收款经办人id
        /// </summary>
        [Required(ErrorMessage = "经办人不能为空")]
        public long AgentPeoperUserId { get; set; }

        /// <summary>
        /// 收款时间
        /// </summary>
        public DateTime? Dateofreceipt { get; set; } = DateTime.Now;

        /// <summary>
        /// 餐厅
        /// </summary>
        [Required(ErrorMessage = "餐厅不能为空")]
        public Guid RestaurantId { get; set; }

        /// <summary>
        /// 收款账户
        /// </summary>
        public Guid CapitalAccountId { get; set; }

        /// <summary>
        /// 应收回金额(WholeAmount-PreferentialAmount)
        /// </summary>
        public decimal ActualAmount { get; set; } = 0m;

        /// <summary>
        /// 使用预收款
        /// </summary>
        public decimal UsePrePayment { get; set; }

        /// <summary>
        /// 实际收回金额
        /// </summary>
        public decimal TaskBackAmount { get; set; }

        /// <summary>
        /// 预收款剩余金额
        /// </summary>
        public decimal UsePrePaymentSurplus { get; set; }

        /// <summary>
        /// 收款状态 0 未审核1已审核
        /// </summary>
        public ReceiptInfoStatus ReceiptInfoStatus { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        public string RemarksConten { get; set; }

        /// <summary>
        /// 单据Id
        /// </summary>
        public List<ReceiptSettlementDto> Settlements { get; set; }
    }

    public class ReceiptSettlementDto
    {
        public Guid SettlementId { get; set; }


        /// <summary>
        /// 未收金额
        /// </summary>
        public decimal uncollected { get; set; }

        /// <summary>
        /// 本次收款
        /// </summary>
        public decimal receipt { get; set; }

        /// <summary>
        /// 优惠金额
        /// </summary>
        public decimal offer { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        public string Remarks { get; set; }
    }
}
